Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

597
Visualizações
What is causing Error: .eslintrc.js: Environment key "vue/setup-compiler-macros" is unknown

I am developing a sample app using Vue 3 and Typescript. Specifically, I am using the new Vue v3.2 setup option in the section of the Vue SFC. Vue docs advise me to add "vue/setup-compiler-macros" to the env secyion of the eslintrc.js file which was working. But I am now getting an error

Syntax Error: Error: .eslintrc.js:
        Environment key "vue/setup-compiler-macros" is unknown
    at Array.forEach (<anonymous>)

for a while this seemed to disappear if I restarted VS Code (not a great workaround, I admit), but now even this does not work. The error occurs when I save a file and the project is compiled. I appear to be using VS Code extension - ESLint v2.2.2.

eslintrc.js:

  module.exports = {
  root: true,
  env: {
    'vue/setup-compiler-macros': true,
    node: true,
  },
  extends: [
    'plugin:vue/vue3-essential',
    'eslint:recommended',
    '@vue/typescript/recommended',
  ],
  parserOptions: {
    ecmaVersion: 2020,
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
  },
}

Any ideas would be greatly appreciated.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I have same problem, solved by config

  globals: {
    defineProps: "readonly",
    defineEmits: "readonly"
  }

the offical guide is here, I dont't know the 'vue/setup-compiler-macros': true, why not work

over 4 years ago · Santiago Trujillo Relatório

0

You can check this answer which helped me properly solve this problem.

You basically need to:

  1. Remove babel-eslint by running npm uni -D babel-eslint on your terminal.
  2. Install @babel/eslint-parser by running npm i -D @babel/eslint-parser on your terminal.
  3. Update the env line in your ESLint config (could be inside .eslintrc.js, .eslintrc.json or package.json) with the following:
  env: {
    node: true,
    'vue/setup-compiler-macros': true,
  },
  1. Update the parserOptions line in your ESLint config with the following:
  parserOptions: {
    parser: '@babel/eslint-parser',
    ecmaVersion: 2018,
    requireConfigFile: false, // This will prevent Babel from looking for a config file you possibly don’t have or need.
  },
  1. If there’s a parser line outside parserOptions, you can simply remove it to avoid conflicts.
over 4 years ago · Santiago Trujillo Relatório

0

You need to upgrade eslint-plugin-vue to version 8 which added it according to its release notes. Se also https://github.com/vuejs/eslint-plugin-vue/pull/1685

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda